// ============================== 导入依赖 ============================== //

// ============================== 导出异步调用 ============================== //

export default {
  // —————————————————————————————— 修改 —————————————————————————————— //

  async remoteEdit({ state: { API, one }, rootState: { API: ROOT_API, add } }) {
    if (one.dealType === 1) {
      const tipAdd = API.transTip(add.one.operate, ROOT_API)
      const [, { id, orderCode }] = await API.add(add.one, tipAdd)

      one.dealDesc = add.one.description
      one.dealWorkOrder = `${id},${orderCode}`
    }

    const tipEdit = API.transTip(one.operate, ROOT_API)
    const msg = await API.edit(one, tipEdit)
    return msg
  },
}
